<template>
  <div class>
    <headers></headers>
    <div class="banner">
      <p>{{ dat.name }}</p>
    </div>
    <div class="title">
      <el-breadcrumb separator="/">
        <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
        <el-breadcrumb-item>
          <a href="/">{{ dat.name }}</a>
        </el-breadcrumb-item>
      </el-breadcrumb>
    </div>

    <div class="header">
      <div class="he1">
        <ul>
          <li
            v-for="(item, index) in list"
            @click="aa(item.id, index)"
            :class="[index == id ? 'ac' : '']"
            :key="index"
            router
          >
            {{ item.name }}
          </li>
        </ul>
      </div>
      <div class="he2">
        <p>{{ dat.name }}</p>
        <span v-html="dat.content"></span>
        <router-view></router-view>
      </div>
    </div>

     <div class='foot'>
     <div>
         <p>© 2021 GiiBee</p>
         <p>郑州市高新区高新万科广场</p>
     </div>
       
     </div>
  </div>
</template>

<script>
import headers from "../components/header";
import { about, abouttap } from "../api/about";
export default {
  data() {
    return {
      list: [],
      dat: [],
      id: "",
    };
  },
  watch: {
    $route: {
      deep: true,
      immediate: true,
      handler(newVal) {
        console.log(newVal);
        if (newVal.query.id == 0) {
          this.id = 0;
          abouttap("47fd5dd0-d34e-41c5-9375-fbdfc21b405a").then((res) => {
            // console.log(res);
            this.dat = res.data;
          });
        } else {
          this.id = 1;
          abouttap("4aa124a1-35f3-4c05-a5ce-46b9a581cf48").then((res) => {
            // console.log(res);
            this.dat = res.data;
          });
        }
      },
    },
  },
  created() {
    // console.log(this.$route.query.id);

    // this.id = 1;
    about().then((res) => {
      // console.log(res);
      this.list = res.data.data;
    });
  },
  mounted() {},
  methods: {
    aa(e, b) {
      console.log(this.list);
      this.id = b;
      // console.log(b);
      abouttap(e).then((res) => {
        console.log(res);
        this.dat = res.data;
      });
      // if (this.id == 0) {
      //   this.$router.push('/my')
      // } else {
      //   this.$router.push('/lx')
      // }
    },
  },
  components: {
    headers,
  },
};
</script>

<style lang="scss" scoped>
.foot{
    width: 100%;
    height: 80px;
    border: 1px solid #ccc;
    margin-top: 20px;
    div{
     text-align: center;
     p{
         margin-top: 10px;
     }
    }
}
.ac {
  background-color: #17a2b6;
  color: white;
}
* {
  margin: 0;
  padding: 0;
}
.title {
  width: 80%;
  padding: 20px 5px;
  background-color: #e9ecef;
  border-radius: 10px;
  margin: auto;
}
.banner {
  text-align: center;
  width: 80%;
  border-radius: 10px;
  height: 400px;
  margin: 20px auto;
  background-image: url(../assets/img/0b02b5d4cacc55c3c5a07095b1fc79621634348848700.jpg);
  background-size: 100%;
  background-repeat: no-repeat;
  vertical-align: middle;

  p:nth-child(1) {
    padding-top: 100px;
    text-shadow: 3px 3px 3px #423f3f;
    font-size: 40px;
    color: white;
  }
  p:nth-child(2) {
    text-shadow: 3px 3px 3px #423f3f;

    font-size: 25px;
    color: white;
  }
}
.header {
  width: 80%;
  margin: 20px auto;
  display: flex;
  .he1 {
    width: 25%;
    ul {
      list-style: none;
      border: 1px solid #ccc;
      border-radius: 5px;
      li {
        padding: 10px;
        font-size: 20px;
        color: #423f3f;
      }
    }
  }
  .he2 {
    border-radius: 5px;
    padding: 20px;
    border: 1px solid #ccc;
    width: 70%;
    margin-left: 40px;
    p {
      font-size: 20px;
    }
    // height: 50px;
  }
}
</style>
